package fenyu.personblob.web.model;

import com.google.gson.Gson;

/**
 * create at 2018/12/22 10:34
 *
 * @author 纷羽 <gzj0078@gmail.com>
 */
public class ApiReponse<T> {

    private Integer code;

    private T data;

    private String message;


    public ApiReponse(T data) {
        this.code = 1;
        this.message = "ok";
        this.data = data;
    }

    public ApiReponse(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    private ApiReponse(Integer code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}
